<template>
	<view>
		<cu-custom :isBack="true">
			<block slot="backText"></block>
			<block slot="content">{{corpCode}}-其它拣货</block>
		</cu-custom>
		<view class="cu-bar bg-white search fixed" :style="[{top:CustomBar + 'px',zIndex:99}]">
			<view class="search-form round">
				<text class="cuIcon-search"></text>
				<input @confirm="sub" v-model="soDjno" type="text" placeholder="输入搜索的关键词" focus></input>
			</view>
			<view class="action" @click="toScan">
				<text class="cuIcon-scan" style="font-size: 56rpx;"></text>
			</view>
		</view>
		<scroll-view scroll-y="true" class="indexes"  :scroll-with-animation="true"
		 :enable-back-to-top="true" :style="[{height:'calc(100vh - '+ CustomBar + 'px - 50px)'}]">
			<!-- <view class="cu-form-group ">
			 	<view class="title" >拣货数量：</view>
			 	<input :value="cinvname" placeholder="暂无数据" name="input"  ></input>
			 </view> -->
			<view class="padding" style="font-weight: 1000; font-size: 16px;padding-bottom:0 ;">{{soH}}  
				<view v-if="soDjnoPos != ''" style="float: right;" >
					<button v-if="iqtyNum > 0"  class="cu-btn bg-gradual-orange shadow-blur round shadow margin-left" @tap="reload" >刷新货位</button>
					<button v-if="iqtyNum > 0" class="cu-btn bg-gradual-blue shadow-blur round shadow margin-left" @click="showPos" data-target="DrawerModalR">整单货位查询</button>
				</view>
				<view style="margin-top: 5px;">
					剩余 <b style="color: #0081FF;font-size: 18px;"> {{iqtyNum}} </b> 条
				</view>
			</view>
			<block v-for="(item,index) in soData" :key="index">
				<view :id="'index_'+soData[index].invCode">
						<view class="padding" style="font-weight: 700; font-size: 16px; margin-bottom: 20px;">{{item.invCode}} — {{item.invName}}
							<view style="float: right;" ><button class="cu-btn bg-gradual-green shadow-blur round shadow margin-left" @tap="showModal" data-target="DrawerModalR">推荐货位</button>
							</view>
						</view>
						<!-- <view style="margin-bottom: 10px;text-align: right;padding-right: 15px;">
							<button class="cu-btn bg-gradual-green shadow-blur round shadow margin-left" @tap="reload" >刷新货位</button>
							<button class="cu-btn bg-gradual-green shadow-blur round shadow margin-left" @tap="showModal" data-target="DrawerModalR">推荐货位</button>
						</view> -->
						<view style="position: relative;width: 100%;">
							<view style="position: absolute;z-index: 999;font-size: 35px;right: 20rpx;top:240rpx;background: #fff;color: red;
							border: 2px solid red;min-width: 140rpx;height: 120rpx;line-height: 120rpx;padding: 0 10px;text-align: center;" >
								{{item.sortNum}}
							</view>
							<view v-if="iqtyNum > 0" style="position: absolute;z-index: 999;right: 20rpx;top:405rpx;width: 35%;padding: 0 5px;
							display: flex;padding: 5px;align-items: center;background: rgba(255,255,255,.9);border-radius: 20upx;border: 1px solid #aaa;">
								<input v-model ="sortNum" style="border: 1px solid #aaa;flex: 3;height: 66rpx;padding: 5px;"  placeholder=" "  name="input" type="number"></input>
								<view @click="jump" style="flex: 2;height: 100%;margin-left: 5px;text-align: center;">
									跳转
								</view>
							</view>
						</view>
						
						<form >
							<view class="scroll-view-item">
								<view class="cu-form-group ">
									<view class="title" >拣货数量：</view>
									<input :value="item.iqty" placeholder="暂无数据" name="input" disabled="false" ></input>
								</view>
								<view class="cu-form-group ">
									<view class="title" >剩余数量：</view>
									<input :value="item.syJhQty" placeholder="暂无数据" name="input" disabled="false" ></input>
								</view>
								<!-- <view class="cu-form-group">
									<view class="title">备注：</view>
									<input :value="item.remarks" placeholder="暂无数据" name="input" disabled="false"></input>
								</view> -->
								<view class="cu-form-group ">
									<view class="title" >是否检验：{{ischeack?"是":"否"}}</view>
								</view>
								<view class="cu-form-group ">
									<view class="title" >仓库：{{ whCode }}</view>
								</view>
								<view class="cu-form-group ">
									<view class="title" >推荐货位：{{item.advPos || ''}}</view>
								</view>
								<view class="cu-form-group" v-for="(items,indexs) in soData[index].soHw" :key="indexs">
									<view class="title">货位名称：</view>
									<input v-model="items.hw" placeholder="B-11" name="input" disabled="false"></input>
									<view class="title">取货数量：</view>
									<input v-model ="items.xjiqty"  placeholder="0" name="input" type="number"></input>
									<view style="float: right;" ><button class="cu-btn round" @click="deleteone(index,indexs)">-</button>
									</view>
								</view>
								<!-- <view style="float: right;" ><button class="cu-btn round" @click="hwInvIqty(index)">+</button></view> -->
							</view>
						</form>
				</view>
			</block>
			<button type="primary" style="margin-top: 10px;" class="no-border confirm-btn" :disabled="isReC" @click="createSo">下架</button>
			<view style="height: 120rpx;width: 100%;">
				
			</view>
			<!-- </view> -->
		</scroll-view>
		<view class="action-section" style="left: 3%;">
			<view v-if="iqtyNum > 0">
				<button type="primary" class=""  @click="upBefor">上一条</button>
			</view>
		</view>
		
		<!-- <view v-if="iqtyNum > 0" class="action-section" style="left: 32%;width: 35%;padding: 0 5px;display: flex;padding: 5px;">
			<input v-model ="sortNum" style="border: 1px solid #aaa;flex: 3;height: 66rpx;padding: 5px;"  placeholder=" "  name="input" type="number"></input>
			<view @click="jump" style="flex: 2;height: 100%;margin-left: 5px;text-align: center;">
				跳转
			</view>
		</view> -->
		<view class="action-section">
			<view v-if="iqtyNum > 0">
				<button type="primary" class=""  @click="upAfter">下一条</button>
			</view>
		</view>
		
		<view class="cu-modal drawer-modal justify-end" :class="modalName=='DrawerModalR'?'show':''" @tap="hideModal">
			<view class="cu-dialog basis-lg" @tap.stop="" :style="[{top:CustomBar+'px',height:'calc(100vh - ' + CustomBar + 'px)',width:'80%'}]">
				<view>
					<view v-if="cHList.length<1" class="nodata">暂无数据</view>
					<view class="cu-list menu"  v-for="(item,index) in cHList" :key="index">
						<view class="cu-item" >
							<view class="content padding-tb-sm">
								
								<view class="text-black text-sm view-s"  style="text-align: left;">仓库：<text  class="t-text"  style="float: right;"> {{item.cwhname}}</text></view>
								<view class="text-black text-sm view-s"  style="text-align: left;">货位：<text  class="t-text" > {{item.cposname}}</text></view>
								<view class="text-black text-sm view-s"  style="text-align: left;">数量：<text  class="t-text" > {{item.iquanttity}}</text></view>
								
							</view>
						</view>
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import {
		mapState
	} from 'vuex';
	export default {
		data() {
			return {
				sortNum:'',
				CustomBar: this.CustomBar, //滚动定位用
				modalName: null,
				cinvname:"",
				soDjno2:'',
				soDjno:'',  //拣货单号
				soDjnoPos:'',//存储拣货单号
				invPosData:[],//存整单存量查询返回的值
				soData:[], //查询出来的值
				soH: '', //客户名称
				soC: [],
				soMain:[],
				list:[],
				iqtyNum :'0',
				indexList:0,
				isReC : false,
				cHList:[],
				ischeack:false,
				whCode: '',
			}
		},
		onLoad() {
			 // this.soDjno = 'jh_102_GG2106170001';
			 // this.sub();
		},
		computed: {
			...mapState(['hasLogin', 'userInfo', 'auditlist', 'corpCode']),
		},
		methods: {
			/** 扫发出声音*/
			makeSound(name){
				console.log("=====testClick=====");
				let src = '../../static/'+name+'.mp3';
				//实例化声音  
				const Audio = uni.createInnerAudioContext();
				Audio.autoplay = true;
				Audio.src = src; //音频地址  
				Audio.play(); //执行播放  
				Audio.onError((res) => {
				});
				Audio.onPause(function() {
					console.log('end');
					Audio.destroy();
				});
			},
			hasLogins(){
				if(!this.hasLogin){
					uni.navigateTo({
						url: '/pages/public/login'
					})
					return;
				} 
			},
			deleteone(index,indexs){
				uni.showModal({
					title: '提示',
					content: '是否删除该货位！',
					success: res => {
						if (res.confirm) {
							this.soData[index].soHw.splice(indexs, 1);
						} 
					}
				});
			},
			jump(){
				
				if(this.soData[0].sortNum == this.sortNum){
					this.$api.msg('已在当前页!');
				}else{
					let flag = false
					this.list.forEach((item,index)=>{
						if(this.sortNum == item.sortNum){
							this.insertListHc(this.list,index);
							flag = true
						}
					})
					if(!flag){
						this.$api.msg('当前序号已拣货完成!');
					}
				}
			},
			upBefor(){
				if(this.indexList != 0){
					this.insertListHc(this.list,this.indexList-1);
				}else{
					this.$api.msg('已到首页!');
					return;
				}
			},
			upAfter(){
				if(this.indexList != this.list.length-1){
					this.insertListHc(this.list,this.indexList+1);
				}else{
					this.$api.msg('已到最后一页!');
					return;
				}
			},
			cleanAll(){
				this.soData = [];
				this.soDjno='';
				this.soH='';
				this.soC = [
					// {
					// 	djno:'',
					// 	ccuscode:'',
					// 	pid:'',
					// 	pdid:'',
					// 	viewCode:'',
					// 	cinvcode:'',
					// 	cinvname:'',
					// 	pickqty:'',
					// 	iqty:'',
					// 	soHw :[],
					// 	bpdid:'',
					// 	}
				];
				this.soMain=[
					// {
					// 	djno:'',
					// 	ccuscode:'',
					// 	pid:'',
					// 	pdid:'',
					// 	cinvcode:'',
					// 	pickqty:'',
					// 	iqty:'',
					// 	hw:'',
					// 	bpdid:'',
					// }
				];
			},
			// sub原始方法
			sub1(){ 
				this.hasLogins();
				if(this.soDjno.indexOf("hw")>-1){
					uni.request({
						url:this.serverURL_a+'/so/App/getHw',
						data:{
							hw : this.soDjno,
							__sid:this.userInfo.sessionid
						},
						header: {
							'content-type': 'application/x-www-form-urlencoded;charset=utf-8',
						},
						method: 'POST',
						success:function(data){
							this.soDjnoPos = this.soDjno;
							this.soDjno = '';
							var requrt = data.data;
							if(requrt.code == '1001'){
								var hwdata = requrt.resMap;
								if(this.soData[0].soHw.length > 0){
									if( this.soData[0].soHw[0].cwhcode != hwdata.basWarehouse.cwhcode){
										uni.showModal({
										    content: '请选择同一仓库货位！',
											showCancel:false,
										});
									   return;
									}
								}
								var hw = {
									hwcode:hwdata.cposcode,
									hw:hwdata.cposname,
									cwhcode:hwdata.basWarehouse.cwhcode,
									xjiqty:this.soC[0].iqty,
								};
								this.soData[0].soHw.push(hw);
							}else{
								this.$api.msg(requrt.msg);
								uni.showModal({
								    content: requrt.msg,
									showCancel:false,
								});
								return;
							}
						}.bind(this),
						fail:function(){
							this.$api.msg('服务已停止,请稍后再试');
							return;
						}.bind(this),
					});
				return;
				}else if(this.soDjno.indexOf("sc") > -1 || this.soDjno.indexOf("dh") > -1 || this.soDjno.indexOf("po") > -1 || this.soDjno.indexOf("inv") > -1){
					//验证数据
					this.cheackinv();
					return;
				}else if(this.soDjno.indexOf("jh")==-1){
					this.$api.msg('请扫描正确的拣货单号!');
					return;
				}
				// var id = this.soDjno.split("_")[2];
				// this.soDjno = id;
				this.loadData();
			},
			sub(){
				this.hasLogins();
				if(this.soDjno.indexOf("hw")>-1){
					uni.request({
						url:this.serverURL_a+'/so/App/getHw',
						data:{
							hw : this.soDjno,
							__sid:this.userInfo.sessionid
						},
						header: {
							'content-type': 'application/x-www-form-urlencoded;charset=utf-8',
						},
						method: 'POST',
						success:function(data){
							// this.soDjnoPos = this.soDjno;
							this.soDjno = '';
							var requrt = data.data;
							if(requrt.code == '1001'){
								var hwdata = requrt.resMap;
								if(this.soData[0].soHw.length > 0){
									if( this.soData[0].soHw[0].cwhcode != hwdata.basWarehouse.cwhcode){
										uni.showModal({
										    content: '请选择同一仓库货位！',
											showCancel:false,
										});
									   return;
									}
								}
								var hw = {
									hwcode:hwdata.cposcode,
									hw:hwdata.cposname,
									cwhcode:hwdata.basWarehouse.cwhcode,
									xjiqty:this.soC[0].iqty,
								};
								this.soData[0].soHw.push(hw);
								// this.$forceUpdate()
							}else{
								this.$api.msg(requrt.msg);
								uni.showModal({
								    content: requrt.msg,
									showCancel:false,
								});
								return;
							}
						}.bind(this),
						fail:function(){
							this.$api.msg('服务已停止,请稍后再试');
							return;
						}.bind(this),
					});
				return;
				}else if(this.soDjno.indexOf("jh")> -1){
					this.loadData();
					return;
				}else if(!this.soDjno){
					this.$api.msg('请扫描正确的拣货单号!');
					return;
				}
				this.cheackinv();
			},
			cheackinv(){
				var inv = this.list[this.indexList].invCode;
				uni.request({
					// url:this.serverURL_a+'/bas/basInventory/findMapCinvcode',
					url:this.serverURL_a+'/barcode/decode/getInvInfo',
					data:{
						// hw : this.soDjno,
						__sid:this.userInfo.sessionid,
						barCode: this.soDjno,
						bneedStore: '0',
						bmustAcct:'0'
					},
					header: {
						'content-type': 'application/x-www-form-urlencoded;charset=utf-8',
					},
					method: 'POST',
					success:function(res){
						console.log(res,'res==');
						this.soDjnoPos=this.soDjno;
						this.soDjno = '';
						if(res.data.result=="false"){
							uni.showModal({
							  content: res.data.message,
							  showCancel:false,
							})
							return false;
						}
						var cinvcode = res.data.data.basInv.viewCode;//存货
						if(cinvcode == inv){
							this.ischeack = true;
						}else{
							this.ischeack = false;
							uni.showModal({
							  content: "存货验证不通过，请重新扫码验证!",
							  showCancel:false,
							})
						}
						return;
					}.bind(this),
					fail: function() {
						uni.hideLoading()
						this.$api.msg('无法连接服务，请联系管理');
						this.isReC = false;
						return;
					}.bind(this)
				})
			},
			hwInvIqty(index){
				var hw = [{
					hwcode:'',
					hw:'',
					xjiqty:'',
				}];
				this.soData[index].soHw.push(hw);
			},
			//分装件货清单数据
			insertListHc(list,index){
				this.hasLogins();
				this.indexList = index;
				this.iqtyNum = list.length;
				for(var i=index;i<list.length;i++){
					
					// this.soC[0].ccuscode = list[i].companyCode;
					// this.soC[0].viewCode = list[i].viewCode;
					// this.soC[0].pid = list[i].hid.id;
					// this.soC[0].pdid = list[i].id;
					// this.soC[0].cinvcode = list[i].invCode;
					// this.soC[0].cinvname = list[i].invName;
					// this.soC[0].pickqty = list[i].qty;
					// this.soC[0].iqty = list[i].qty - list[i].itotalQty;
					// this.soC[0].bpdid = list[i].autoid;
					// this.soH = list[0].companyName;
					this.soC[0] = list[i];
					this.soC[0].soHw = [];
					this.soC[0].djno = this.soHead.djno;
					this.soH = this.soHead.companyName;
					break;
				}
				this.sortNum = this.soC[0].sortNum;
				this.soData = this.soC;
				this.ischeack = false;
				this.$forceUpdate()
			},
			reload(){
				this.hasLogins();
				uni.showLoading({
				  title: '加载中...',
				  mask: true, // 是否显示透明蒙层，防止触摸穿透
				});
				
				uni.request({
					url:this.serverURL_a+'/so/App/updateAdvPosOrther',
					data:{
						id : this.soHead.id,
						__sid:this.userInfo.sessionid
					},
					header: {
						'content-type': 'application/x-www-form-urlencoded;charset=utf-8',
					},
					method: 'POST',
					success:function(data){
						// this.soDjnoPos=this.soDjno;
						uni.hideLoading();
						var res = data.data;
						if(res.result == 'true'){/*  */
							uni.request({
								url:this.serverURL_a+'/so/App/findJhOrtherData',
								data:{
									djno : this.soDjno2,
									__sid:this.userInfo.sessionid
								},
								header: {
									'content-type': 'application/x-www-form-urlencoded;charset=utf-8',
								},
								method: 'POST',
								success:function(data){
									// this.soDjnoPos=this.soDjno;
									// this.soDjno2=this.soDjno;
									this.cleanAll();
									var requrt = data.data;
									if(requrt.code == '1001'){/*  */
										this.soHead = requrt.resMap;
										this.whCode = requrt.resMap.whCode;
										var list = requrt.resMap.childList;
										this.insertListHc(list,0);
										this.list = list;
									}else{
										uni.showModal({ 
										    content: requrt.msg,
											showCancel:false,
										});
										return;
									}
								}.bind(this),
								fail:function(){
									this.$api.msg('服务已停止,请稍后再试');
									return;
								}.bind(this),
							});
							
						}else{
							uni.showModal({ 
							    content: res.msg,
								showCancel:false,
							});
							return;
						}
					}.bind(this),
					fail:function(){
						this.$api.msg('服务已停止,请稍后再试');
						return;
					}.bind(this),
				});
				
				
				
				
			},
			loadData(){
				this.hasLogins();
				uni.request({
					url:this.serverURL_a+'/so/App/findJhOrtherData',
					data:{
						djno : this.soDjno,
						__sid:this.userInfo.sessionid
					},
					header: {
						'content-type': 'application/x-www-form-urlencoded;charset=utf-8',
					},
					method: 'POST',
					success:function(data){
						this.soDjnoPos=this.soDjno;
						this.soDjno2=this.soDjno;
						this.cleanAll();
						var requrt = data.data;
						if(requrt.code == '1001'){/*  */
							this.soHead = requrt.resMap;
							this.whCode = requrt.resMap.whCode
							var list = requrt.resMap.childList;
							this.insertListHc(list,0);
							this.list = list;
							this.reload()
						}else{
							uni.showModal({ 
							    content: requrt.msg,
								showCancel:false,
							});
							return;
						}
					}.bind(this),
					fail:function(){
						this.$api.msg('服务已停止,请稍后再试');
						return;
					}.bind(this),
				});
			},
			showModal(e) {
				this.modalName = e.currentTarget.dataset.target
				this.findHWData();
			},
			showPos(e){
				if(this.soDjno2 == ''){
					uni.showModal({
					    content: "请扫描正确的拣货单！",
						showCancel:false,
					});
					return;
				}
				const that=this
				const cwhcode = this.whCode;
				uni.navigateTo({
					url: '/pages/invXjOther/invXjPosOther?soDjno='+that.soDjno2 + '&cwhcode=' + cwhcode,
					success: function(res) { 
					// 通过eventChannel向被打开页面传送数据
						// res.eventChannel.emit('acceptDataFromOpenerPage', that.invPosData)
					}
				})
			},
			hideModal(e) {
				this.modalName = null
			},
			findHWData(){
				let cinvcode=this.soC[0].invCode;
				let cwhcode = this.whCode;
				uni.request({
					url:this.serverURL_a+'/wh/u8/u8InvpositionSum/sumListData?__ajax=json',
					data:{
						cwhcode : cwhcode,
						cinvcode : cinvcode,
						__sid:this.userInfo.sessionid
					},
					header: {
						'content-type': 'application/x-www-form-urlencoded;charset=utf-8',
					},
					method: 'POST',
					success:function(data){
						let ret = data.data;
						if(data.statusCode!="200"){
							uni.showModal({
								content: ret.message,
								showCancel:false,
							});
							return;
						}
						this.cHList=data.data;
					}.bind(this),
					fail:function(){
						this.$api.msg('服务已停止,请稍后再试');
						return;
					}.bind(this),
				});
			},
			ChooseCheckbox(e) {
				let items = this.checkbox;
				let values = e.currentTarget.dataset.value;
				for (let i = 0, lenI = items.length; i < lenI; ++i) {
					if (items[i].value == values) {
						items[i].checked = !items[i].checked;
						break
					}
				}
			},
			toScan() {
				uni.scanCode({
					onlyFromCamera: true,
					success: function(res) {
						this.soDjno = res.result;
						this.soDjnoPos=res.result;
						this.sub();
					}.bind(this)
				});
			},
			createSo(){
				this.isReC = true
				console.log(11111,this.soData);
				this.hasLogins();
				if(!this.ischeack){
					uni.showModal({
					  content: "存货验证未通过，请重新扫码验证!",
					  showCancel:false,
					})
					this.makeSound("sb");
					this.isReC = false;
					return;
				}
				if(this.iqtyNum == 0){
					this.$api.msg('暂无数据,不能提交！');
					this.isReC = false;
					this.makeSound("sb");
					return;
				}
				// if(this.isReC){
				// 	this.$api.msg('请不要重复提交！');
				// 	this.makeSound("sb");
				// 	return;
				// }
				var qhiqty = 0;
				let arr = this.soData.map(item=>{
					let obj = {
						djno:item.djno,
						childId:item.id,
						csource:'1',
						posList:item.soHw.map(e=>{
							qhiqty = parseFloat(qhiqty) + parseFloat(e.xjiqty)
							return {
								posCode:e.hwcode,
								iqty:e.xjiqty,
							}
						})
					}
					return obj
				})
				let param = arr[0]
				if(!this.soData[0].soHw.length){
					this.$api.msg('请选择下架货位！');
					this.isReC = false;
					this.makeSound("sb");
					return;
				}
				if(qhiqty > this.soData[0].syJhQty){
					uni.showModal({
					    content: '取货数量不能大于拣货剩余数量！',
						showCancel:false,
					});
					this.isReC = false;
					this.makeSound("sb");
					return;
				}
				
				// this.soC = this.soData;
				// for(var i=0;i<this.soC.length;i++){
				// 	this.soMain[i].djno = this.soC[i].djno;
				// 	this.soMain[i].ccuscode = this.soC[i].ccuscode;
				// 	this.soMain[i].pid = this.soC[i].pid;
				// 	this.soMain[i].pdid = this.soC[i].pdid;
				// 	this.soMain[i].cinvcode = this.soC[i].cinvcode;
				// 	if(this.soData[i].soHw.length < 1){
				// 		this.$api.msg('请选择下架货位！');
				// 		this.isReC = false;
				// 		this.makeSound("sb");
				// 		return;
				// 	}
				// 	this.soMain[i].hw = JSON.stringify(this.soData[i].soHw);
				// 	this.soMain[i].pickqty = this.soC[i].pickqty;
				// 	this.soMain[i].iqty = this.soC[i].pickqty;
				// 	this.soMain[i].bpdid = this.soC[i].bpdid;
				// 	var qhiqty = 0;
				// 	for(var j=0;j<this.soC[i].soHw.length;j++){
				// 		qhiqty = parseFloat(qhiqty) + parseFloat(this.soC[i].soHw[j].xjiqty);
				// 	}
				// 	if(qhiqty > this.soC[i].iqty){
				// 		uni.showModal({
				// 		    content: '取货数量不能大于拣货剩余数量！',
				// 			showCancel:false,
				// 		});
				// 		this.isReC = false;
				// 		this.makeSound("sb");
				// 		return;
				// 	}
				// }
				// let delh = this.soMain;
				// let red = JSON.stringify(delh);
				uni.showModal({
					content: "是否提交!",
					success: function(res) {
						var _this = this;
						if (res.confirm) {
							uni.showLoading({
							    title: '数据提交中',
								 mask:true
							});
							uni.request({
								url:this.serverURL_a + '/so/App/addXjOrther?__sid=' + this.userInfo.sessionid,
								data:param,
								header: {
									'content-type': 'application/json',
								},
								method: 'POST',
								success:function(data){
									uni.hideLoading();
									let ret = data.data;
									this.isReC = false;
									if(data.statusCode!="200"){
										uni.showModal({
										    content: ret.message,
											showCancel:false,
										});
										this.makeSound("sb");
										return;
									}
									if(ret.result=="true"){
											this.cleanAll();
											this.$api.msg("下架成功！");
											this.list.splice(this.indexList, 1);
											if(this.list.length > 0){
												if(this.indexList == this.list.length){
													this.insertListHc(this.list,this.indexList-1);
												}else{
													this.insertListHc(this.list,this.indexList);
												}
											}else{
												this.iqtyNum = 0;
											}
											this.makeSound("cg");
											return;
									}else{
										uni.showModal({
										    content: ret.message,
											showCancel:false,
										});
										this.isReC = false;
										this.makeSound("sb");
										return;
									}
								}.bind(this),
								fail: function() {
									this.$api.msg('无法连接服务，请联系管理');
									this.isReC = false;
									return;
								}.bind(this)
							});
						} else if (res.cancel) {
							this.isReC = false;
							return
						}
					}.bind(this)
				});
			}
		}
	}
</script>

<style>
page {
		padding-top: 100upx;
	}

	.indexes {
		position: relative;
	}
	
	/* 底部栏 */
	.action-section{
		/* #ifdef H5 */
		/* #endif */
		position:fixed;
		left: 75%;
		bottom:30upx;
		z-index: 95;
		display: flex;
		align-items: center;
		background: rgba(255,255,255,.9);
		border-radius: 20upx;
		.checkbox{
			height:52upx;
			position:relative;
			image{
				width: 52upx;
				height: 100%;
				position:relative;
				z-index: 5;
			}
		}
		.clear-btn{
			position:absolute;
			left: 26upx;
			top: 0;
			z-index: 4;
			width: 0;
			height: 52upx;
			line-height: 52upx;
			padding-left: 38upx;
			font-size: $font-base;
			color: #fff;
			background: $font-color-disabled;
			border-radius:0 50px 50px 0;
			opacity: 0;
			transition: .2s;
			&.show{
				opacity: 1;
				width: 120upx;
			}
		}
		.total-box{
			flex: 1;
			display:flex;
			flex-direction: column;
			text-align:right;
			padding-right: 40upx;
			.price{
				font-size: $font-lg;
				color: $font-color-dark;
			}
			.coupon{
				font-size: $font-sm;
				color: $font-color-light;
				text{
					color: $font-color-dark;
				}
			}
		}
		.confirm-btn{
			padding: 0 38upx;
			margin: 0;
			border-radius: 100px;
			height: 76upx;
			line-height: 76upx;
			font-size: $font-base + 2upx;
			background: $uni-color-primary;
		}
	}

	.indexBar {
		position: fixed;
		right: 0px;
		bottom: 0px;
		padding: 20upx 20upx 20upx 60upx;
		display: flex;
		align-items: center;
	}

	.indexBar .indexBar-box {
		width: 40upx;
		height: auto;
		background: #fff;
		display: flex;
		flex-direction: column;
		box-shadow: 0 0 20upx rgba(0, 0, 0, 0.1);
		border-radius: 10upx;
	}

	.indexBar-item {
		flex: 1;
		width: 40upx;
		height: 40upx;
		display: flex;
		align-items: center;
		justify-content: center;
		font-size: 24upx;
		color: #888;
	}

	movable-view.indexBar-item {
		width: 40upx;
		height: 40upx;
		z-index: 9;
		position: relative;
	}

	movable-view.indexBar-item::before {
		content: "";
		display: block;
		position: absolute;
		left: 0;
		top: 10upx;
		height: 20upx;
		width: 4upx;
		background-color: #f37b1d;
	}

	.indexToast {
		position: fixed;
		top: 0;
		right: 80upx;
		bottom: 0;
		background: rgba(0, 0, 0, 0.5);
		width: 100upx;
		height: 100upx;
		border-radius: 10upx;
		margin: auto;
		color: #fff;
		line-height: 100upx;
		text-align: center;
		font-size: 48upx;
	}
	.list-title{
		display: inline-block;
		width: 33%;
		text-align: center;
	}
</style>
